package com.kattomy.ssh.service.impl;

import java.util.List;

import com.kattomy.ssh.dao.EmployeeDao;
import com.kattomy.ssh.entities.Employee;
import com.kattomy.ssh.service.EmployeeService;

public class EmployeeServiceImpl implements EmployeeService{

	private EmployeeDao employeeDao;
	
	public void setEmployeeDao(EmployeeDao employeeDao) {
		this.employeeDao = employeeDao;
	}
	
	@Override
	public List<Employee> getAllEmployee() {
		
		return employeeDao.getAll();
	}

	@Override
	public void deleteEmployee(Integer id) {
		employeeDao.delete(id);
	}

	@Override
	public void saveOrUpdateEmployee(Employee employee) {
		employeeDao.saveOrUpdate(employee);
	}

	@Override
	public Employee getEmployee(Integer id) {
		return employeeDao.get(id);
	}

	@Override
	public boolean validForLastName(String lastName) {
		return employeeDao.queryEmployeeByLastName(lastName) == null;
	}

}
